/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package asfabdesk.dominio;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author marco.machado
 */
@NamedQueries(value = {
    @NamedQuery(name = "depositoPorNome", query = "SELECT d FROM DepositoFinanceiro d WHERE upper(d.descricao) LIKE upper(?)"),
    @NamedQuery(name = "depositoAptoEntrada", query = "SELECT d FROM DepositoFinanceiro d WHERE d.realizaEntrada =true"),
    @NamedQuery(name = "depositoAptoSaida", query = "SELECT d FROM DepositoFinanceiro d WHERE d.realizaSaida =true"),
    @NamedQuery(name = "depositoAptoTransf", query = "SELECT d FROM DepositoFinanceiro d WHERE d.realizaTransferencia =true"),
    @NamedQuery(name = "depositoAtivo", query = "SELECT d FROM DepositoFinanceiro d WHERE d.status=true")
})
@Entity
@Table(name="DEPOSITO_FINANCEIRO")
public class DepositoFinanceiro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String descricao;
    @Column(name="realiza_saida")
    private boolean realizaSaida=false;
    @Column(name="realiza_entrada")
    private boolean realizaEntrada=false;
    @Column(name="realiza_transferencia")
    private boolean realizaTransferencia=false;
    @Column(name="fundo_monetario")
    private double fundoMonetario=0; // (R$)
    private boolean status=true ; // ativo/inativo
    @JoinColumn(name = "USUARIOS", referencedColumnName = "id")
    @ManyToOne
    private Usuario usuarioCadastrante; // funcionario ASFAB

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public double getFundoMonetario() {
        return fundoMonetario;
    }

    public void setFundoMonetario(double fundoMonetario) {
        this.fundoMonetario = fundoMonetario;
    }

    public boolean isRealizaEntrada() {
        return realizaEntrada;
    }

    public void setRealizaEntrada(boolean realizaEntrada) {
        this.realizaEntrada = realizaEntrada;
    }

    public boolean isRealizaSaida() {
        return realizaSaida;
    }

    public void setRealizaSaida(boolean realizaSaida) {
        this.realizaSaida = realizaSaida;
    }

    public boolean isRealizaTransferencia() {
        return realizaTransferencia;
    }

    public void setRealizaTransferencia(boolean realizaTransferencia) {
        this.realizaTransferencia = realizaTransferencia;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public Usuario getUsuarioCadastrante() {
        return usuarioCadastrante;
    }

    public void setUsuarioCadastrante(Usuario usuarioCadastrante) {
        this.usuarioCadastrante = usuarioCadastrante;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DepositoFinanceiro)) {
            return false;
        }
        DepositoFinanceiro other = (DepositoFinanceiro) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "asfabdesk.dominio.DepositoFinanceiro[id=" + id + "]";
    }

}
